﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Shell;
using Microsoft.Phone.Controls;
using Common.Library;
using OnlineVideos.Common;
using System.Collections.Generic;
//using Common.Common;

namespace OnlineVideos.UI
{
    public static class ContextMenuHelper
    {
        public static void PinSongAsLiveTile(string ShowID, string ShowTitle, string ShowImage, string SongTitle)
        {
            StandardTileData TileInfo = new StandardTileData
            {
                BackgroundImage = new Uri("isostore:/Shared/ShellContent/secondary/" + ShowImage, UriKind.RelativeOrAbsolute),
                Title = SongTitle,
                BackContent = ShowTitle,

            };
            Uri uri = new Uri("/Views/SongDetails.xaml?id=" + ShowID + "&chapter=" + ShowTitle + "&id+cno=" + SongTitle, UriKind.Relative);

            ShellTileHelper.Pin(uri, TileInfo);
        }
        public static void ContextMenu_Opened(object sender)
        {
            


            ContextMenu mainmenu = sender as ContextMenu;
            foreach (MenuItem contextMenuItem in mainmenu.Items)
            {
                if (contextMenuItem.Name == "Pin")
                {
                    if (ShellTileHelper.IsPinned(AppSettings.ShowLinkTitle))
                    {
                        contextMenuItem.Header = Constants.PinToStartScreen;
                    }
                    else
                    {
                        contextMenuItem.Header = Constants.UnpinFromStartScreen;
                    }
                }
                if (contextMenuItem.Name == "Rating")
                {
                    contextMenuItem.Header = AppResources.AllowRatingLinkContextMenuLabel;
                }

            }
        }
    }
}
